// npm i opn
const vscode = require('vscode')
const betterOpn = require('better-opn')
const { getUrl } = require("./utils.js")

const OpenInBrowser = function(path = '', options) {
  // process.env.OPEN_MATCH_HOST_ONLY = 'true';
  let url = getUrl(options)

  betterOpn(url)
  .then(res => {
    // ...
  })
  .catch(err => {
    vscode.window.showErrorMessage(`Sorry! Open browser failed!!`);
  })
}

exports.OpenInBrowser = OpenInBrowser